<?php

namespace App\Http\Presenters\Sku;

use Laracasts\Presenter\Presenter;

class ProductPresenter extends Presenter
{
    /**
     * Present a link to the user gravatar
     */    
    public function effectStatus()
    {
        switch ($this->effect) 
        {
            case 1:
                return '<span class="grey number align-middle coupon-effective">购买后'.$this->date_n.'天内</span>';
                break;
            case 2:
                return '<span class="grey number align-middle coupon-effective">'.date('n月j日',strtotime($this->date_begin)).'至'.date('n月j日',strtotime($this->date_end)).'</span>';
                break;            
            default:
                break;
        }
    }


    public function saleStatus()
    {
        $result = '';

        if($this->status == 1)
            $result = $result.'<span class="coupon coupon-scope-4">上架</span> ';
        
        if($this->is_hot == 1)
            $result = $result.'<span class="coupon coupon-scope-2">热销</span> ';
        
        if($this->is_recommend == 1)
            $result = $result.'<span class="coupon coupon-type-2">推荐</span> ';

        if($this->is_new == 1)
            $result = $result.'<span class="coupon coupon-type-3">新品</span>';

        return $result;
        
    }


    public function shopTrade()
    {
        switch ($this->trade) 
        {
            case SHOP_TRADE_OWN:
                return '<span class="green"><i class="iconfont" data-id="'.$this->id.'">&#xe86d;</i></span>';
                break;
            case SHOP_TRADE_SELF:
                return '<span class="blue"><i class="iconfont" data-id="'.$this->id.'">&#xe858;</i></span>';
                break;
            case SHOP_TRADE_DIRECT:
                return '<span class="purple"><i class="iconfont" data-id="'.$this->id.'">&#xe865;</i></span>';
                break;
            case SHOP_TRADE_CHAIN:
                return '<span class="red"><i class="iconfont" data-id="'.$this->id.'">&#xe623;</i></span>';
                break;
        }
    }


    public function shopProgressLabel()
    {
        switch ($this->progress) 
        {
            case SHOP_PROGRESS_BEGIN:
                return '<span class="grey"><i class="iconfont bigger-120" data-id="'.$this->id.'">&#xe995;</i>合作洽谈</span>';
                break;
            case SHOP_PROGRESS_CONTRACT:
                return '<span class="blue"><i class="iconfont bigger-120" data-id="'.$this->id.'">&#xe984;</i>合同已签</span>';
                break;
            case SHOP_PROGRESS_DOCUMENT:
                return '<span class="red"><i class="iconfont bigger-120" data-id="'.$this->id.'">&#xe99b;</i>文案完成</span>';
                break;
            case SHOP_PROGRESS_PRODUCT:
                return '<span class="brown"><i class="iconfont bigger-120" data-id="'.$this->id.'">&#xe99e;</i>产品制作</span>';
                break;
            case SHOP_PROGRESS_ONLINE:
                return '<span class="green"><i class="ace-icon fa fa-check" data-id="'.$this->id.'"></i>门店上线</span>';
                break;
        }
    }


}
